package eleven.senven.hpb.utils;

import android.os.Environment;

import java.io.File;

import eleven.senven.hpb.config.AppConfig;


/**
 * Created by T400 on 15-6-25.
 */
public class FileUtils {
    public static String getAppLujing(){
        String lujing = null;
        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
            lujing = Environment.getExternalStorageDirectory()+ File.separator+ AppConfig.APP_LUJING;
        }else{
            lujing=Environment.getDataDirectory()+File.separator+ AppConfig.ROOT_CACHE;
        }
        File cacheFile = new File(lujing);
        if (!cacheFile.exists()){
            cacheFile.mkdirs();
        }
        return  lujing;
    }
    public static String getImageCache() {
        String imageLujing = getAppLujing()+File.separator+AppConfig.IMAGE_CACHE;
        File file = new File(imageLujing);
        if (!file.exists()){
            file.mkdirs();
        }
        return imageLujing;
    }

    public  static  String getDbPath(){
        String dbLujing =getAppLujing()+ File.separator+AppConfig.DBPATH;
        File file = new File(dbLujing);
        if (!file.exists()){
            file.mkdir();
        }
        return dbLujing;
    }
}
